home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 1.iso / connect / _j2 / wvnsc926 / rcs / wvprint.c < prev    next >
C/C++ Source or Header  |  1994-09-21  |  68KB  |  2,468 lines

  1. head     1.22;
  2. branch   ;
  3. access   ;
  4. symbols  V80:1.4 V76d:1.3;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.22
  10. date     94.09.16.01.06.33;  author jcooper;  state Exp;
  11. branches ;
  12. next     1.21;
  13.  
  14. 1.21
  15. date     94.08.03.22.17.18;  author dumoulin;  state Exp;
  16. branches ;
  17. next     1.20;
  18.  
  19. 1.20
  20. date     94.08.03.00.35.20;  author dumoulin;  state Exp;
  21. branches ;
  22. next     1.19;
  23.  
  24. 1.19
  25. date     94.08.02.23.30.11;  author dumoulin;  state Exp;
  26. branches ;
  27. next     1.18;
  28.  
  29. 1.18
  30. date     94.08.02.05.01.48;  author dumoulin;  state Exp;
  31. branches ;
  32. next     1.17;
  33.  
  34. 1.17
  35. date     94.07.28.21.19.12;  author dumoulin;  state Exp;
  36. branches ;
  37. next     1.16;
  38.  
  39. 1.16
  40. date     94.07.28.21.14.05;  author dumoulin;  state Exp;
  41. branches ;
  42. next     1.15;
  43.  
  44. 1.15
  45. date     94.07.26.22.17.28;  author dumoulin;  state Exp;
  46. branches ;
  47. next     1.14;
  48.  
  49. 1.14
  50. date     94.06.30.16.32.13;  author dumoulin;  state Exp;
  51. branches ;
  52. next     1.13;
  53.  
  54. 1.13
  55. date     94.06.23.23.11.30;  author dumoulin;  state Exp;
  56. branches ;
  57. next     1.12;
  58.  
  59. 1.12
  60. date     94.06.17.09.08.14;  author dumoulin;  state Exp;
  61. branches ;
  62. next     1.11;
  63.  
  64. 1.11
  65. date     94.06.14.20.22.37;  author dumoulin;  state Exp;
  66. branches ;
  67. next     1.10;
  68.  
  69. 1.10
  70. date     94.05.19.02.06.10;  author dumoulin;  state Exp;
  71. branches ;
  72. next     1.9;
  73.  
  74. 1.9
  75. date     94.01.15.20.41.22;  author jcoop;  state Exp;
  76. branches ;
  77. next     1.8;
  78.  
  79. 1.8
  80. date     93.12.08.01.28.38;  author rushing;  state Exp;
  81. branches ;
  82. next     1.7;
  83.  
  84. 1.7
  85. date     93.08.09.17.57.47;  author dumoulin;  state Exp;
  86. branches ;
  87. next     1.6;
  88.  
  89. 1.6
  90. date     93.08.05.15.46.42;  author dumoulin;  state Exp;
  91. branches ;
  92. next     1.5;
  93.  
  94. 1.5
  95. date     93.07.06.21.09.09;  author cnolan;  state Exp;
  96. branches ;
  97. next     1.4;
  98.  
  99. 1.4
  100. date     93.05.25.00.00.55;  author rushing;  state Exp;
  101. branches ;
  102. next     1.3;
  103.  
  104. 1.3
  105. date     93.03.09.01.24.21;  author dumoulin;  state Exp;
  106. branches ;
  107. next     1.2;
  108.  
  109. 1.2
  110. date     93.02.16.22.52.25;  author dumoulin;  state Exp;
  111. branches ;
  112. next     1.1;
  113.  
  114. 1.1
  115. date     93.02.16.20.54.22;  author rushing;  state Exp;
  116. branches ;
  117. next     ;
  118.  
  119.  
  120. desc
  121. @winvn version 0.76 placed into RCS
  122. @
  123.  
  124.  
  125. 1.22
  126. log
  127. @rearranged headers to allow use of precompiled headers
  128. @
  129. text
  130. @/***************************************************************************
  131.  *                                       *
  132.  *  MODULE    : WVPRINT.C                           *
  133.  *                                       *
  134.  *                  Jim Dumoulin  NASA/KSC                                 *
  135.  *                                                                         *
  136.  *                                                                         *
  137.  *  PURPOSE    : Printing code for WinVN.                                 *
  138.  *                                       *
  139.  *  FUNCTIONS    : FreePrinterMemory ()       -  Frees all memory associated  *
  140.  *                                            with a printer device context*
  141.  *                                                                         *
  142.  *          : GetPrinterDC ()       -  Creates a printer DC for the *
  143.  *                          default device.           *
  144.  *                                       *
  145.  *          : DeletePrinterDC ()       -  Deletes a printer DC for the *
  146.  *                          default device.           *
  147.  *                                       *
  148.  *          AbortProc ()           -  Export proc. for GDI to check*
  149.  *                                       *
  150.  *                          print abort.           *
  151.  *                                       *
  152.  *          PrintDlgProc ()       -  Dialog function for the print*
  153.  *                          cancel dialog.           *
  154.  *                                                                         *
  155.  *                ReportPrintError ()     -  Decodes err codes for calls   *
  156.  *                                            to Windows print functions   *
  157.  *                                       *
  158.  *                PrintHeaderP ()          -  Determines if header string  *
  159.  *                                            is one that gets printed     *
  160.  *                                                                         *
  161.  *          PrintArticle ()          -  Prints the contents of the   *
  162.  *                          an article window.       *
  163.  ***************************************************************************/
  164.  
  165.  
  166. /*
  167.  *
  168.  * $Id: wvprint.c 1.21 1994/08/03 22:17:18 dumoulin Exp $
  169.  * $Log: wvprint.c $
  170.  * Revision 1.21  1994/08/03  22:17:18  dumoulin
  171.  * Cleaned up word wrapping in error messages
  172.  *
  173.  * Revision 1.20  1994/08/03  00:35:20  dumoulin
  174.  * Fixed bug upon exit and startup for folks that don't have
  175.  * any printers.
  176.  *
  177.  * Revision 1.19  1994/08/02  23:30:11  dumoulin
  178.  * Fixed problem with AbortProc that could cause Printing to not
  179.  * work with some print drivers
  180.  *
  181.  * Revision 1.18  1994/08/02  05:01:48  dumoulin
  182.  * More testing to debug WinVN printing problem with some drivers
  183.  *
  184.  * Revision 1.17  1994/07/28  21:19:12  dumoulin
  185.  * removed print.h
  186.  *
  187.  * Revision 1.16  1994/07/28  21:14:05  dumoulin
  188.  * yet another attempt at fixing printing
  189.  *
  190.  * Revision 1.15  1994/07/26  22:17:28  dumoulin
  191.  * Changed function prototype for printing function
  192.  *
  193.  * Revision 1.14  1994/06/30  16:32:13  dumoulin
  194.  * Fix Printing Bug - Call stack problem with AbortProc Procedure
  195.  *
  196.  * Revision 1.13  1994/06/23  23:11:30  dumoulin
  197.  * Added support for new Print Dialog box and features
  198.  *
  199.  * Revision 1.12  1994/06/17  09:08:14  dumoulin
  200.  * Attempts to fix the Unable to Initialize Document printing bug
  201.  *
  202.  * Revision 1.11  1994/06/14  20:22:37  dumoulin
  203.  * Fix various printer problems due to short instead of int variable
  204.  *
  205.  * Revision 1.10  1994/05/19  02:06:10  dumoulin
  206.  * *** empty log message ***
  207.  *
  208.  * Revision 1.9  1994/01/15  20:41:22  jcoop
  209.  * Use GetEditText instead of EM_GETHANDLE with global editWnds
  210.  *
  211.  * Revision 1.8  1993/12/08  01:28:38  rushing
  212.  * new version box and cr lf consistency
  213.  * 
  214.  * Revision 1.7  1993/08/09  17:57:47  dumoulin
  215.  * Fix to AbortProc and PrintArticle to fix GPFs
  216.  *
  217.  * Revision 1.6  1993/08/05  15:46:42  dumoulin
  218.  * Rewrote PrintArticle to solve print crashes
  219.  *
  220.  * Revision 1.5  1993/07/06  21:09:09  cnolan
  221.  * win32 support
  222.  *
  223.  * Revision 1.4  1993/05/25  00:00:55  rushing
  224.  * rot13 merge (MRB)
  225.  *
  226.  * Revision 1.3  1993/03/09  01:24:21  dumoulin
  227.  * Added italics for quoted regions in prints
  228.  *
  229.  * Revision 1.2  1993/02/16  22:52:25  dumoulin
  230.  * moved rcs ident comment below file description
  231.  *
  232.  * Revision 1.1  1993/02/16  20:54:22  rushing
  233.  * Initial revision
  234.  *
  235.  *
  236.  */ 
  237. #include <windows.h>
  238. #include <windowsx.h>
  239. #include "wvglob.h"
  240. #include "winvn.h"
  241. #pragma hdrstop
  242.  
  243. BOOL PdlgAbort = FALSE;            /* TRUE if the user has aborted the print job     */
  244. HWND hwndPDlg = NULL;         /* Handle to the cancel print dialog         */
  245.  
  246. /****************************************************************************
  247.  *                                        *          
  248.  *  FUNCTION   : AbortProc()                            *
  249.  *                                        *
  250.  *  PURPOSE    : To be called by GDI print code to check for user abort.    *
  251.  *               Returns TRUE to continue Printing, FALSE to cancel.        *
  252.  *                                        *
  253.  ****************************************************************************/
  254. BOOL CALLBACK AbortProc ( HDC hdc,int nCode)
  255. {
  256.   MSG msg; 
  257.   char mes[60];
  258.     
  259.     if ((nCode < 0) && (nCode != SP_OUTOFDISK))
  260.       {
  261.         sprintf(mes,"AbortProc Error %d", (int) nCode);
  262.         MessageBox(NULL, "Your Windows Print Driver CallBack \n procedure "
  263.                          "returned an error",mes,MB_OK | MB_ICONEXCLAMATION);
  264.         return FALSE; 
  265.       }
  266.     else                  
  267.     /* Allow other apps to run, or get abort messages */
  268.   //  while (!PdlgAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
  269.        while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
  270.          {
  271.        if (!hwndPDlg || !IsDialogMessage (hwndPDlg, &msg))
  272.             {
  273.              TranslateMessage (&msg);
  274.              DispatchMessage  (&msg);
  275.             }
  276.           }
  277.  
  278.       if (PdlgAbort == TRUE) return FALSE;
  279.        else
  280.         return TRUE;
  281. }
  282.  
  283.  
  284. /****************************************************************************
  285.  *                                        *
  286.  *  FUNCTION   : PrinterInit ()                                   *
  287.  *                                        *
  288.  *  PURPOSE    : Initializes Global Variables used by the Printing Code     *
  289.  *                                        *
  290.  *  RETURNS    : TRUE if successful, FALSE if not                             *
  291.  *                                        *
  292.  ****************************************************************************/
  293. BOOL WINAPI PrinterInit(void)
  294.  {
  295.    pd.lStructSize = (DWORD) sizeof(PRINTDLG);
  296.    pd.hDevMode = NULL;
  297.    pd.hDevNames = NULL;
  298.    pd.Flags = PD_RETURNDC;
  299.    pd.hDC = (HDC) NULL;
  300.    pd.nFromPage = 0;
  301.    pd.nToPage = 0;
  302.    pd.nMinPage = 0;
  303.    pd.nMaxPage = 0xFFFE;
  304.    pd.nCopies = 1;
  305.    pd.hInstance = (HANDLE) NULL;
  306.    pd.lCustData = 0L;
  307.    pd.lpfnPrintHook = (UINT) NULL;
  308.    pd.lpfnSetupHook = (UINT) NULL;
  309.    pd.lpPrintTemplateName = (LPSTR) NULL;
  310.    pd.lpSetupTemplateName = (LPSTR) NULL;
  311.    pd.hPrintTemplate = (HANDLE) NULL;
  312.    pd.hSetupTemplate = (HANDLE) NULL; 
  313.    
  314.    hFontPrint = NULL;
  315.    hFontPrintB = NULL;
  316.    hFontPrintI = NULL;
  317.    hFontPrintS = NULL;
  318.    
  319.    return TRUE;
  320.  }
  321.       
  322. /****************************************************************************
  323.  *                                        *
  324.  *  FUNCTION   : FreePrinterMemory ()                        *
  325.  *                                        *
  326.  *  PURPOSE    : Frees any memory structures allocated for the Printer      *
  327.  *         Device context.                                            *
  328.  *         It also sets iPrinter to the supported level of printing.  *
  329.  *                                        *
  330.  *  RETURNS    : TRUE if successful else FALSE                          *
  331.  *                                        *
  332.  ****************************************************************************/
  333. BOOL WINAPI FreePrinterMemory(void)
  334.  {
  335.   if (pd.hDevMode)  GlobalFree(pd.hDevMode);
  336.   if (pd.hDevNames) GlobalFree(pd.hDevNames);
  337.   if (pd.hDC) DeletePrinterDC(pd.hDC);              
  338.   PrinterInit();
  339.   return TRUE;
  340.  }
  341.  
  342. /****************************************************************************
  343.  *                                        *
  344.  *  FUNCTION   : PrinterSetup ()                        *
  345.  *                                        *
  346.  *  PURPOSE    : Creates a printer display context for the default device.  *
  347.  *         As a side effect, it sets the szDevice and szPort variables*
  348.  *         It also sets iPrinter to the supported level of printing.  *
  349.  *                                        *
  350.  *  RETURNS    : Zero if successful, 1 = cancel, else Extended Error Code   *
  351.  *                                        *
  352.  ****************************************************************************/
  353. DWORD WINAPI PrinterSetup(HWND hwnd,DWORD flags)
  354.  { 
  355.   char mes[60];
  356.   DWORD  cError = 0;
  357.             
  358.   pd.hwndOwner = hwnd;
  359.   pd.Flags = flags;
  360.                                            
  361.   if (pd.hDC != 0) DeletePrinterDC(pd.hDC);
  362.    
  363.   if (PrintDlg(&pd) == 0)
  364.     {                              
  365.       cError = CommDlgExtendedError();
  366.       if (cError != 0)
  367.        { 
  368.         sprintf(mes,"Comm Dialog Box Extended Error %d", (DWORD) cError);
  369.         MessageBox(hwnd, "WinVN was unable to either display a \n"
  370.                          "Printer Device Context Dialog Box or \n"
  371.                          "to get a Printer Device Context"
  372.                          ,mes,MB_OK | MB_ICONEXCLAMATION);
  373.         FreePrinterMemory();
  374.         return cError;
  375.        }
  376.        else return 1; 
  377.     } 
  378.     else
  379.       return 0;
  380.  }
  381.  
  382. /****************************************************************************
  383.  *                                        *
  384.  *  FUNCTION   : GetPrinterDC ()                        *
  385.  *                                        *
  386.  *  PURPOSE    : Finds or creates a printer display context for the         *
  387.  *               selected printer.                                          *
  388.  *                                        *
  389.  *  RETURNS    : HDC - A handle to printer DC or Null if error                *
  390.  *                                        *
  391.  ****************************************************************************/
  392. HDC WINAPI GetPrinterDC(HWND hwnd)
  393.  {        
  394.   DWORD pError = 0;
  395.   
  396.   if (pd.hDC)
  397.       return pd.hDC;
  398.   else 
  399.     {
  400.      if ((pd.hDevMode == NULL) && (pd.hDevNames == NULL))
  401.        pError = PrinterSetup(hwnd,PD_RETURNDC | PD_RETURNDEFAULT);
  402.      else 
  403.        pError = PrinterSetup(hwnd,PD_RETURNDC);
  404.       
  405.      if (pError > 0) return NULL;
  406.      else  return pd.hDC;
  407.     }
  408.  }
  409.  
  410. /****************************************************************************
  411.  *                                        *
  412.  *  FUNCTION   : DeletePrinterDC ()                        *
  413.  *                                        *
  414.  *  PURPOSE    : Releases a printer display context for the selected        *
  415.  *               printer.                                                   *
  416.  *                                        *
  417.  *  RETURNS    : 0 if Successful, 1 if Error                            *
  418.  *                                        *
  419.  ****************************************************************************/
  420.  
  421. BOOL WINAPI DeletePrinterDC(HDC hDC)
  422.  {
  423.   BOOL err1 = FALSE;
  424.   BOOL err2 = FALSE;
  425.  
  426.   if (pd.hDC != hDC)
  427.     err1 = DeleteDC(pd.hDC);
  428.     
  429.   err2 = DeleteDC (hDC);
  430.   pd.hDC = NULL; 
  431.   return err1 & err2;
  432.   }
  433.  
  434.  
  435. /****************************************************************************
  436.  *                                        *
  437.  *  FUNCTION   : PrintDlgProc ()                        *
  438.  *                                        *
  439.  *  PURPOSE    : Dialog function for the print cancel dialog box.        *
  440.  *                                        *
  441.  *  RETURNS    : TRUE  - OK to abort/ not OK to abort                *
  442.  *         FALSE - otherwise.                        *
  443.  *                                        *
  444.  ****************************************************************************/
  445. LRESULT CALLBACK PrintDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  446.  {                    
  447.     switch (msg)
  448.       {                    
  449.     case WM_INITDIALOG:
  450.         hwndPDlg = hwnd;
  451.         ShowWindow (hwnd, SW_SHOW);
  452.         break;
  453.  
  454.     case WM_COMMAND:   /* abort printing if the cancel button gets hit */
  455.         switch (LOWORD (wParam))
  456.          { 
  457.           case ID_OK:
  458.           case ID_CANCEL:
  459.                 
  460.              PdlgAbort = TRUE;
  461.              EnableWindow(GetParent (hwnd), TRUE);
  462.                  if (hwndPDlg) DestroyWindow (hwndPDlg);    /* Delete Cancel Dialog */            
  463.                  hwndPDlg = NULL;
  464.              return TRUE; 
  465.           }
  466.           break;
  467.       }
  468.     return FALSE;
  469.  }
  470.  
  471. /****************************************************************************
  472.  *                                        *
  473.  *  FUNCTION   : ReportPrintError ()                        *
  474.  *                                        *
  475.  *  PURPOSE    : Decodes error codes from calls to Windows Print functions  *
  476.  *                                        *
  477.  *  RETURNS    : NULL  - No errors or Error has already been reported       *
  478.  *         short - Error code numbers (from Windows.H)                *
  479.  *                                        *
  480.  ****************************************************************************/
  481.  
  482. void WINAPI ReportPrintError(int nError,HWND hWnd)
  483.      {
  484.       char mes[60];
  485.  
  486.     if (nError >= 0)
  487.        return;
  488.  
  489.     if ((nError & SP_NOTREPORTED) == 0)
  490.        return;
  491.  
  492.         switch(nError)
  493.          {
  494.           case  SP_ERROR:
  495.               MessageBox(hWnd, "The Windows Printer Device driver \n"
  496.                                "cannot begin printing your document. \n"
  497.                                "Your printer may be off line or out of \n"
  498.                                "paper.  It is also possible that the \n"
  499.                                "Windows Print Manager isn't loaded and \n"
  500.                                "another program is currently printing",
  501.                                "General Printing Error",
  502.                                MB_OK | MB_ICONEXCLAMATION);
  503.               break;
  504.  
  505.           case  SP_APPABORT:
  506.               MessageBox(hWnd, "Your Print request has been canceled \n"
  507.                                "via an Abort request from your application",
  508.                                "Print Canceled by Application",
  509.                                MB_OK | MB_ICONEXCLAMATION);
  510.               break;
  511.  
  512.           case  SP_USERABORT:
  513.               MessageBox(hWnd, "Your Print request has been canceled \n"
  514.                                "via a User cancel request from the \n"
  515.                                "Windows Print Manager",
  516.                                "Print Canceled by User",
  517.                                MB_OK | MB_ICONEXCLAMATION);
  518.               break;
  519.  
  520.           case  SP_OUTOFDISK:
  521.               MessageBox(hWnd, "Your Print request has been aborted \n"
  522.                                "due to insufficient disk space in your \n"
  523.                                "Windows TEMP subdirectory",
  524.                                "Out of Disk Space",
  525.                                MB_OK | MB_ICONEXCLAMATION);
  526.               break;
  527.  
  528.           case  SP_OUTOFMEMORY:
  529.               MessageBox(hWnd, "Your Print request has been aborted \n"
  530.                                "due to insufficient Windows memory.\n"
  531.                                "Close some applications and try again",
  532.                                "Out of Memory Space",
  533.                                MB_OK | MB_ICONEXCLAMATION);
  534.               break;
  535.  
  536.          default:
  537.  
  538.               sprintf(mes,"Unknown Print Error %d", (int) nError);
  539.               MessageBox(hWnd, "Your Print request has been aborted due to \n"
  540.                                "the Windows Print function returning an error \n"
  541.                                "code that is Undocumented",mes,
  542.                                MB_OK | MB_ICONEXCLAMATION);
  543.               break;
  544.  
  545.          }
  546.     return;
  547.      }
  548.  
  549.  
  550. /****************************************************************************
  551.  *                                        *
  552.  *  FUNCTION   : PrintHeaderP ()                        *
  553.  *                                        *
  554.  *  PURPOSE    : Determines if this is a header we are printing            *
  555.  *                                        *
  556.  *        Entry:  str    substring to search                                *
  557.  *                limit  limits the search to no more than num characters   *
  558.  *                                                                          *
  559.  *        Exit:   BOOL   TRUE if we are not excluding print this header     *
  560.  *                       FALSE if we are explicited excluding header        *
  561.  *                                        *
  562.  ****************************************************************************/
  563.  
  564. BOOL WINAPI PrintHeaderP(char *str,int limit)
  565.   {
  566.     if (CompareStringNoCase(str,"Relay-Version:",limit) == 0
  567.         || CompareStringNoCase(str,"Path:",limit) == 0
  568.         || CompareStringNoCase(str,"References:",limit) == 0
  569.         || CompareStringNoCase(str,"Xref:",limit) == 0)
  570.       return(FALSE);
  571.     else
  572.       return(TRUE);
  573.   } 
  574.  
  575.  
  576. /****************************************************************************
  577.  *                                        *
  578.  *  FUNCTION   : PrintFile ()                            *
  579.  *                                        *
  580.  *  PURPOSE    : Prints the contents of the edit control.            *
  581.  *                                        *
  582.  ****************************************************************************/
  583.  
  584. void WINAPI PrintFile(HWND hwnd)
  585. {
  586.     HDC     hdc;
  587.     int     yExtPage;
  588.     char    sz[32];
  589.     WORD    cch;
  590.     WORD    ich;
  591.     char *  pch;
  592.     WORD    iLine;
  593.     WORD    nLinesEc;
  594.     char *  pT;
  595.     ABORTPROC lpfnAbort;
  596.     DLGPROC   lpfnPDlg;
  597.     WORD    dy;
  598.     int     yExtSoFar;
  599.     WORD    fError = TRUE;
  600.     HWND    hwndEdit;
  601.     SIZE    size;
  602.  
  603.     hwndEdit = (HWND)GetWindowWord(hwnd,GWW_HWNDEDIT);
  604.     lstrcpy(sz,"WinVN Print Request");
  605.     cch = lstrlen(sz);
  606.     PdlgAbort = FALSE;
  607.     
  608.     /* Make instances of the Abort proc. and the Print dialog function */
  609.     lpfnAbort =(ABORTPROC) MakeProcInstance ((FARPROC) AbortProc, hInst);
  610.     if (!lpfnAbort)
  611.     goto getout;
  612.     lpfnPDlg = (DLGPROC) MakeProcInstance ((FARPROC) PrintDlgProc, hInst);
  613.     if (!lpfnPDlg)
  614.     goto getout4;
  615.  
  616.     /* Initialize the printer */
  617.  //   hdc = GetPrinterDC();
  618.     if (!hdc)
  619.     goto getout5;
  620.  
  621.     /* Disable the main application window and create the Cancel dialog */
  622.   /*    EnableWindow (hwndFrame, FALSE); */
  623.     hwndPDlg = CreateDialog (hInst, "PRINTDIALOG", hwnd, lpfnPDlg);
  624.     if (!hwndPDlg)
  625.     goto getout3;
  626.     ShowWindow (hwndPDlg, SW_SHOW);
  627.     UpdateWindow (hwndPDlg);
  628.  
  629.     /* Allow the app. to inform GDI of the escape function to call */
  630.     if (Escape (hdc, SETABORTPROC, 0, (LPSTR)lpfnAbort, NULL) < 0)
  631.     goto getout1;
  632.  
  633.     /* Initialize the document */
  634.     if (Escape (hdc, STARTDOC, cch, (LPSTR)sz, NULL) < 0)
  635.     goto getout1;
  636.  
  637.     /* Get the height of one line and the height of a page */
  638.     GetTextExtentPoint (hdc, "CC", 2, &size);
  639.     dy=size.cy;
  640.     yExtPage = GetDeviceCaps (hdc, VERTRES);
  641.  
  642.     /* Get the lines in document and and a handle to the text buffer */
  643.     iLine     = 0;
  644.     yExtSoFar = 0;
  645.     nLinesEc  = (WORD)SendMessage (hwndEdit, EM_GETLINECOUNT, 0, 0L);
  646. //    hT      = (HANDLE)SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L);
  647.     pT = GetEditText (hwndEdit);
  648.     
  649.     /* While more lines print out the text */
  650.     while ((iLine < nLinesEc) && !PdlgAbort) {
  651.     if (yExtSoFar + (int)dy > yExtPage){
  652.         /* Reached the end of a page. Tell device driver to eject page */
  653.         if (Escape (hdc, NEWFRAME, 0, NULL, NULL) < 0 || PdlgAbort)
  654.         goto getout2;
  655.         yExtSoFar = 0;
  656.     }
  657.  
  658.     /* Get the length and position of the line in the buffer
  659.      * and lock from that offset into the buffer */
  660.     ich = (WORD)SendMessage (hwndEdit, EM_LINEINDEX, iLine, 0L);
  661.     cch = (WORD)SendMessage (hwndEdit, EM_LINELENGTH, ich, 0L);
  662. //    pch = (char *)LocalLock(hT) + ich;
  663.     pch = pT + ich;
  664.  
  665.     /* Print the line and unlock the text handle */
  666.     TextOut (hdc, 0, yExtSoFar, (LPSTR)pch, cch);
  667. //    LocalUnlock (hT);
  668.  
  669.     /* Move down the page */
  670.     yExtSoFar += dy;
  671.     iLine++;
  672.     }
  673.     GlobalFreePtr (pT);
  674.     
  675.     /* Eject the last page. */
  676.     if (Escape (hdc, NEWFRAME, 0, NULL, NULL) < 0)
  677.     goto getout2;
  678.  
  679.     /* Complete the document. */
  680.     if (Escape (hdc, ENDDOC, 0, NULL, NULL) < 0){
  681. getout2:
  682.     /* Ran into a problem before NEWFRAME? Abort the document */
  683.     Escape( hdc, ABORTDOC, 0, NULL, NULL);
  684.     }
  685.     else
  686.     fError=FALSE;
  687.  
  688. getout3:
  689.     /* Close the cancel dialog and re-enable main app. window */
  690.     /*    EnableWindow (hwndFrame, TRUE);   */
  691.     DestroyWindow (hwndPDlg);
  692.  
  693. getout1:
  694.     DeleteDC(hdc);
  695.  
  696. getout5:
  697.     /* Get rid of dialog procedure instances */
  698.     FreeProcInstance ((FARPROC) lpfnPDlg);
  699.  
  700. getout4:
  701.     FreeProcInstance ((FARPROC) lpfnAbort);
  702.  
  703. getout:
  704.  
  705.     /* Error? make sure the user knows... */
  706.     if (fError)
  707.         MessageBox(hwnd, "Printing Error","Error",MB_OK);
  708.     return;
  709.  
  710. /****************************************************************************
  711.  *                                        *
  712.  *  FUNCTION   : PrintArticle ()                        *
  713.  *                                        *
  714.  *  PURPOSE    : Prints the current article.                         *
  715.  *                                        *
  716.  ****************************************************************************/
  717.  
  718. #define LEFTMARGIN 6        /* Left Margin in characters on printed page */
  719. #define TOPMARGIN 4         /* Top Margin in characters on printed page */
  720. #define BOTTOMMARGIN 6      /* Bottom Margin in characters on printed page */
  721. #define MAXHEADERSIZE 20    /* Largest number of chars allowed in a header name */
  722.  
  723. void WINAPI PrintArticle(HWND hwnd,TypDoc * Doc)
  724. {    
  725.     char    sz[100];
  726.     char    szTitle[MAXHEADERLINE];
  727.     DOCINFO  di;
  728.     BOOL    found;
  729.     BOOL    inheader = TRUE; 
  730.     int     i,dy,dx,yExtPage,yExtSoFar,nPrintError;
  731.     unsigned int LineLen,Offset,nTotalPages, PageNum, iLine,
  732.                  nCharsPerLine,nLinesPerPage,nTotalLines;
  733.     char    far *textptr;
  734.     char    *loc;
  735.     DWORD   cError = 0;
  736.     TypBlock far *BlockPtr;
  737.     TypLine  far *LinePtr;
  738.     HANDLE hBlock;
  739.     TypLineID MyLineID;
  740.     TEXTMETRIC tm;
  741.     DEVNAMES * dv;
  742.     ABORTPROC lpfnAbortProc = NULL;
  743.     DLGPROC   lpfnPrintDlgProc = NULL;
  744.       
  745.     /* Create the job title */
  746.     di.cbSize = sizeof(di);
  747.     di.lpszDocName = "WinVn Article";
  748.     di.lpszOutput = NULL;
  749.  
  750.     /* Initialize the printer */ 
  751.     nPrintError = 0;
  752.     hwndPDlg = NULL;
  753.     PdlgAbort = FALSE;
  754.     cError = PrinterSetup(hwnd,PD_RETURNDC | PD_USEDEVMODECOPIES); 
  755.     if ((cError != 0) || (pd.hDC == 0)) goto exitout;
  756.  
  757.     /* Reinitialize Fonts just in case the user changed printers on us */
  758.     InitPrintFonts(); 
  759.                                                      
  760.     /*  Create the Cancel dialog and Disable the main application window */
  761.     lpfnPrintDlgProc = (DLGPROC) MakeProcInstance((FARPROC) PrintDlgProc,(HINSTANCE) hInst);
  762.     if (!lpfnPrintDlgProc) goto exitout;
  763.     hwndPDlg = CreateDialog ((HINSTANCE) hInst,(LPCSTR) "PRINTDIALOG",hwnd, (DLGPROC) lpfnPrintDlgProc);
  764.     if (!hwndPDlg) goto exitout;
  765.  
  766.     /* Allow the app. to inform GDI of the Abort function to call */ 
  767.     lpfnAbortProc = (ABORTPROC) MakeProcInstance((FARPROC) AbortProc,(HINSTANCE) hInst);
  768.     if (!lpfnAbortProc) goto exitout; 
  769.     
  770.     EnableWindow (hwnd, FALSE);     
  771.     if (SetAbortProc(pd.hDC,(ABORTPROC) lpfnAbortProc) < 0)
  772.       {
  773.         MessageBox(hwnd, "Unable to Set Abort Procedure",
  774.                          "Error",MB_OK | MB_ICONEXCLAMATION);
  775.         nPrintError = 0;     /* don't print double error messages */
  776.         goto exitout;
  777.       }
  778.  
  779.     /* Get the Subject, printer description and Port number */ 
  780.     found = GetHeaderLine(Doc,"Subject:",szTitle,sizeof(szTitle));
  781.     if (!found) lstrcpy(szTitle,"Subject: No Subject");
  782.     SetDlgItemText ((HWND) hwndPDlg, IDD_PRINTSUBJECT, (LPSTR)szTitle);
  783.     dv = (DEVNAMES *) GlobalLock(pd.hDevNames);
  784.     sprintf(sz,"To %s on %s",(LPSTR) dv+dv->wDeviceOffset,(LPSTR) dv+dv->wOutputOffset);    
  785.     SetDlgItemText ((HWND) hwndPDlg, IDD_PRINTDEVICE, (LPSTR)sz);
  786.     GlobalUnlock(pd.hDevNames);               
  787.     sprintf(sz,"Initializing Document for Printing");
  788.     SetDlgItemText ((HWND) hwndPDlg, IDD_PRINTSTATUS, (LPSTR)sz);
  789.  
  790.     /*  Initialize the Printer Device Context */
  791.     nPrintError = StartDoc(pd.hDC,&di);
  792.     if (hwndPDlg)
  793.       {
  794.        UpdateWindow (hwndPDlg);              /* print to file may overwrite dialog */
  795.        SetFocus(hwndPDlg);
  796.       } 
  797.     if (nPrintError < 0) goto exitout;
  798.  
  799.     LockLine (Doc->hFirstBlock, sizeof(TypBlock), (TypLineID)0L,
  800.                &BlockPtr, &LinePtr);
  801.  
  802.     /* Get the lines in document and and a handle to the text buffer */
  803.     iLine     = 0;
  804.     PageNum   = 1;
  805.     nTotalLines = Doc->TotalLines;
  806.  
  807.     /* Get the height of one line and the height of a page */
  808.     SelectObject(pd.hDC,hFontPrint);         /* Select Printer Font */
  809.     GetTextMetrics(pd.hDC,&tm);
  810.     dy = tm.tmHeight + tm.tmExternalLeading;
  811.     dx = tm.tmAveCharWidth;
  812.     nCharsPerLine = GetDeviceCaps (pd.hDC,HORZRES) / dx;
  813.     nLinesPerPage = GetDeviceCaps (pd.hDC,VERTRES) / dy;
  814.     nTotalPages = (nTotalLines + BOTTOMMARGIN + TOPMARGIN) / nLinesPerPage; 
  815.     if (nTotalPages < 1) nTotalPages = 1;
  816.     yExtPage = GetDeviceCaps (pd.hDC, VERTRES);
  817.     nPrintError = StartPage(pd.hDC);
  818.     if (nPrintError <= 0) goto abortout;
  819.                 
  820.    /* If we are printing the First Page, place the Subject line at the Top */
  821.     if ((((pd.Flags & PD_PAGENUMS) == 0) && ((pd.Flags & PD_SELECTION) == 0)) ||
  822.         (pd.nFromPage == 0) || 
  823.         (pd.nFromPage == 1))
  824.       {     
  825.         sprintf(sz,"Now Printing Page %u of %u",PageNum,nTotalPages);
  826.         SetDlgItemText (hwndPDlg, IDD_PRINTSTATUS, (LPSTR)sz);
  827.         SelectObject(pd.hDC,hFontPrintS);         /* Select Printer Font */ 
  828.         TextOut (pd.hDC,LEFTMARGIN * dx,TOPMARGIN * dy,szTitle,lstrlen(szTitle));
  829.         yExtSoFar = (int)dy * (TOPMARGIN + 4);
  830.        }
  831.  
  832.     /* Print out text until no more lines or user aborts */
  833.     while ((iLine < nTotalLines) && !PdlgAbort) {
  834.     if ((yExtSoFar + (BOTTOMMARGIN + 1) * dy) >= yExtPage)
  835.          {
  836.         /* Reached the end of a page, print Page number */ 
  837.         if  ((((pd.Flags & PD_PAGENUMS) == 0) && 
  838.                   ((pd.Flags & PD_SELECTION) == 0))   ||
  839.                  (((pd.nFromPage == 0) || (PageNum >= pd.nFromPage)) && 
  840.               ((pd.nToPage == 0)   || (PageNum <= pd.nToPage))))
  841.            {
  842.                   SelectObject(pd.hDC,hFontPrintB);
  843.                 sprintf(sz,"Page %u",PageNum);
  844.                 TextOut(pd.hDC, ((nCharsPerLine / 2) * dx),
  845.                                   yExtSoFar + (2 * dy), sz, lstrlen(sz));
  846.  
  847.                 /* Tell device driver to eject page */ 
  848.                  if (PageNum > nTotalPages) nTotalPages = PageNum;
  849.                  sprintf(sz,"Now Printing Page %u of %u",PageNum,nTotalPages);
  850.                  SetDlgItemText (hwndPDlg, IDD_PRINTSTATUS, (LPSTR)sz);
  851.                 nPrintError = EndPage(pd.hDC);
  852.                 if ((nPrintError < 0) || PdlgAbort) break;
  853.                 nPrintError = StartPage(pd.hDC);
  854.                  if ((nPrintError < 0) || PdlgAbort) break;
  855.                }
  856.       
  857.         yExtSoFar = dy * TOPMARGIN;
  858.             PageNum++;
  859.      }
  860.  
  861.     /* Print the line and unlock the text handle */
  862.         if (LinePtr->length != END_OF_BLOCK)
  863.           {
  864.             textptr = (char far *) LinePtr + sizeof(TypLine) + sizeof(TypText);
  865.             LineLen = lstrlen(textptr);
  866.             if (IsLineBlank(textptr)) inheader = FALSE;
  867.             
  868.             if   ((((pd.Flags & PD_PAGENUMS) == 0) && 
  869.                    ((pd.Flags & PD_SELECTION) == 0))   ||
  870.                   (((pd.nFromPage == 0) || (PageNum >= pd.nFromPage)) && 
  871.                ((pd.nToPage == 0)   || (PageNum <= pd.nToPage))))
  872.           {
  873.                 if (inheader)
  874.                    {
  875.                    loc = memchr(textptr,':',MAXHEADERSIZE);
  876.                        if (loc)
  877.                      {
  878.                        i =  loc-textptr+1;
  879.                        if (PrintHeaderP(textptr,i))
  880.                           {
  881.                             SelectObject(pd.hDC,hFontPrintB);
  882.                             TextOut (pd.hDC, (LEFTMARGIN * dx), yExtSoFar, textptr, i);
  883.                             SelectObject(pd.hDC,hFontPrint);
  884.                             TextOut (pd.hDC, (LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  885.                                     yExtSoFar, textptr+i, LineLen - i);
  886.                           }
  887.                      }
  888.                         else
  889.                      {
  890.                          SelectObject(pd.hDC,hFontPrint);
  891.                          TextOut (pd.hDC,(LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  892.                                   yExtSoFar, textptr, LineLen);
  893.                      }
  894.                    }
  895.                  else
  896.                      {
  897.                 if (isLineQuotation(textptr)) SelectObject(pd.hDC,hFontPrintI);
  898.                      else
  899.                        SelectObject(pd.hDC,hFontPrint);
  900.                        
  901.                        TextOut (pd.hDC, (LEFTMARGIN * dx), yExtSoFar, textptr, LineLen);          
  902.                      }
  903.             }
  904.             yExtSoFar += dy;
  905.             NextLine(&BlockPtr,&LinePtr);
  906.           }
  907.  
  908.     /* Move down the page */
  909.     iLine++;
  910.     }
  911.                  
  912. abortout:                                                  
  913.  
  914.     UnlockLine(BlockPtr,LinePtr,&hBlock,&Offset,&MyLineID);
  915.     if (!PdlgAbort && (nPrintError >= 0))
  916.       {
  917.         /* Eject the last page. */
  918.         if ((((pd.Flags & PD_PAGENUMS) == 0) && 
  919.              ((pd.Flags & PD_SELECTION) == 0))   ||
  920.             (((pd.nFromPage == 0) || (PageNum >= pd.nFromPage)) && 
  921.          ((pd.nToPage == 0)   || (PageNum <= pd.nToPage))))
  922.       {
  923.             SelectObject(pd.hDC,hFontPrintB);
  924.               sprintf(sz,"Page %u",PageNum);
  925.               TextOut(pd.hDC, ((nCharsPerLine / 2) * dx),
  926.                               yExtPage - (BOTTOMMARGIN * dy), sz, lstrlen(sz));
  927.             nPrintError = EndPage(pd.hDC);
  928.           }
  929.  
  930.           /* Complete the document. */
  931.           if (!PdlgAbort && (nPrintError >= 0))
  932.           nPrintError = EndDoc(pd.hDC);
  933.       }
  934.  
  935. exitout:
  936.    
  937.       if (PdlgAbort)
  938.       {
  939.         if (pd.hDC) AbortDoc(pd.hDC);
  940.         MessageBox(hwnd, "Print Request Canceled",
  941.                          "Canceled",MB_OK | MB_ICONEXCLAMATION);
  942.        } 
  943.       else
  944.       {
  945.        if (nPrintError < 0)  ReportPrintError(nPrintError,hwnd);
  946.        EnableWindow (hwnd, TRUE);                    /* ReEnable main procedure */
  947.        if (hwndPDlg) DestroyWindow ((HWND) hwndPDlg);       /* Delete Cancel Dialog */ 
  948.       }
  949.       
  950.     if (lpfnPrintDlgProc) FreeProcInstance((FARPROC) lpfnPrintDlgProc);
  951.     if (lpfnAbortProc) FreeProcInstance((FARPROC) lpfnAbortProc); 
  952.         
  953.     return;
  954. }
  955. @
  956.  
  957.  
  958. 1.21
  959. log
  960. @Cleaned up word wrapping in error messages
  961. @
  962. text
  963. @d39 1
  964. a39 1
  965.  * $Id: wvprint.c 1.20 1994/08/03 00:35:20 dumoulin Exp dumoulin $
  966. d41 3
  967. d108 2
  968. a109 4
  969.  
  970. #define STRICT
  971. #include "windows.h"
  972. #include <windowsx.h>    // for GlobalFreePtr
  973. d112 1
  974. @
  975.  
  976.  
  977. 1.20
  978. log
  979. @Fixed bug upon exit and startup for folks that don't have
  980. any printers.
  981. @
  982. text
  983. @d39 1
  984. a39 1
  985.  * $Id: wvprint.c 1.19 1994/08/02 23:30:11 dumoulin Exp dumoulin $
  986. d41 4
  987. d131 1
  988. a131 1
  989.         MessageBox(NULL, "Your Windows Print Driver CallBack procedure  "
  990. d238 2
  991. a239 2
  992.         MessageBox(hwnd, "WinVN was unable to either display a "
  993.                          "Printer Device Context Dialog Box or "
  994. d364 6
  995. a369 6
  996.               MessageBox(hWnd, "The Windows Printer Device driver cannot "
  997.                                "begin printing your document.  Your printer "
  998.                                "may be off line or out of paper.  It is also "
  999.                                "possible that the Windows Print Manager isn't "
  1000.                                "loaded and another program is currently "
  1001.                                "printing",
  1002. d375 2
  1003. a376 2
  1004.               MessageBox(hWnd, "Your Print request has been canceled via an "
  1005.                                "Abort request from your application",
  1006. d382 3
  1007. a384 2
  1008.               MessageBox(hWnd, "Your Print request has been canceled via a User"
  1009.                                "cancel request from the Windows Print Manager",
  1010. d390 3
  1011. a392 3
  1012.               MessageBox(hWnd, "Your Print request has been aborted due to "
  1013.                                "insufficient disk space in your Windows "
  1014.                                "TEMP subdirectory",
  1015. d398 3
  1016. a400 3
  1017.               MessageBox(hWnd, "Your Print request has been aborted due to "
  1018.                                "insufficient Windows memory.  Close some "
  1019.                                "applications and try again",
  1020. d408 2
  1021. a409 2
  1022.               MessageBox(hWnd, "Your Print request has been aborted due to "
  1023.                                "the Windows Print function returning an error "
  1024. @
  1025.  
  1026.  
  1027. 1.19
  1028. log
  1029. @Fixed problem with AbortProc that could cause Printing to not
  1030. work with some print drivers
  1031. @
  1032. text
  1033. @d39 1
  1034. a39 1
  1035.  * $Id: wvprint.c 1.18 1994/08/02 05:01:48 dumoulin Exp dumoulin $
  1036. d41 4
  1037. d202 1
  1038. a202 1
  1039.   DeletePrinterDC(pd.hDC);              
  1040. @
  1041.  
  1042.  
  1043. 1.18
  1044. log
  1045. @More testing to debug WinVN printing problem with some drivers
  1046. @
  1047. text
  1048. @d39 1
  1049. a39 1
  1050.  * $Id: wvprint.c 1.17 1994/07/28 21:19:12 dumoulin Exp dumoulin $
  1051. d41 3
  1052. d98 1
  1053. d104 1
  1054. a104 1
  1055. BOOL PdlgAbort = FALSE;          /* TRUE if the user has aborted the print job     */
  1056. d108 1
  1057. a108 1
  1058.  *                                        *
  1059. d112 1
  1060. d123 1
  1061. a123 1
  1062.         MessageBox(hwndPDlg, "Your Windows Print Driver CallBack procedure  "
  1063. d129 10
  1064. a138 6
  1065.     while (!PdlgAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
  1066.     if (!hwndPDlg || !IsDialogMessage (hwndPDlg, &msg)){
  1067.         TranslateMessage (&msg);
  1068.         DispatchMessage  (&msg);
  1069.     }
  1070.     
  1071. d140 2
  1072. a141 5
  1073.         else
  1074.           return TRUE;
  1075.           
  1076.      // return TRUE;     // teseting JD 7/27/94
  1077.     //return !PdlgAbort;
  1078. d306 1
  1079. a306 1
  1080. BOOL CALLBACK PrintDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  1081. d311 17
  1082. a327 18
  1083.             return TRUE;  
  1084.             
  1085.         case WM_SETTEXT:
  1086.             return TRUE;
  1087.                  
  1088.     case WM_COMMAND:
  1089.         /* abort printing if the cancel button gets hit */
  1090.         PdlgAbort = TRUE;
  1091.             if (hwndPDlg) 
  1092.              {
  1093.                  EnableWindow(GetParent (hwnd), TRUE);
  1094.      //           DestroyWindow (hwndPDlg);    /* Delete Cancel Dialog */            
  1095.      //           hwndPDlg = NULL;
  1096.              }
  1097.         return TRUE;
  1098.  
  1099.     default:
  1100.         return FALSE;
  1101. d329 1
  1102. d466 2
  1103. a467 1
  1104.  
  1105. d614 2
  1106. a615 2
  1107.     cError = PrinterSetup(hwnd,PD_RETURNDC | PD_USEDEVMODECOPIES);
  1108.  
  1109. a619 1
  1110.     EnableWindow (hwnd, FALSE);                                                
  1111. d622 1
  1112. a622 1
  1113.     lpfnPrintDlgProc = (DLGPROC) MakeProcInstance((FARPROC) PrintDlgProc,hInst);
  1114. d624 1
  1115. a624 2
  1116.     hwndPDlg = CreateDialog ((HINSTANCE) hInst,(LPCSTR) "PRINTDIALOG",hwnd, (DLGPROC) lpfnPrintDlgProc); 
  1117.    // hwndPDlg = CreateDialog (hInst,"PRINTDIALOG",hwnd,  PrintDlgProc);
  1118. d627 5
  1119. a631 7
  1120.     ShowWindow (hwndPDlg, SW_SHOW);
  1121.     UpdateWindow (hwndPDlg);
  1122.  
  1123.     /* Allow the app. to inform GDI of the Abort function to call */
  1124.     PdlgAbort = FALSE;
  1125.     lpfnAbortProc = (ABORTPROC) MakeProcInstance(AbortProc,hInst);
  1126.     if (!lpfnAbortProc) goto exitout;
  1127. d656 1
  1128. a656 1
  1129.    //    SetFocus(hwndPDlg);
  1130. d811 2
  1131. a812 2
  1132.   //  if (lpfnPrintDlgProc) FreeProcInstance((FARPROC) lpfnPrintDlgProc);
  1133.   //  if (lpfnAbortProc) FreeProcInstance((FARPROC) lpfnAbortProc); 
  1134. @
  1135.  
  1136.  
  1137. 1.17
  1138. log
  1139. @removed print.h
  1140. @
  1141. text
  1142. @a28 3
  1143.  *          PrintFile ()           -  Prints the contents of the   *
  1144.  *                          edit control.           *
  1145.  *                                                                         *
  1146. d39 1
  1147. a39 1
  1148.  * $Id: wvprint.c 1.16 1994/07/28 21:14:05 dumoulin Exp dumoulin $
  1149. d41 3
  1150. d114 1
  1151. a114 2
  1152.  // hdc;        /* Needed to prevent compiler warning message */
  1153.      
  1154. d300 1
  1155. a300 1
  1156. BOOL WINAPI PrintDlgProc(HWND hwnd, WORD msg, WORD wParam, LPARAM lParam)
  1157. d305 3
  1158. a307 1
  1159.         PdlgAbort = FALSE;  
  1160. d309 1
  1161. a309 1
  1162.  
  1163. d316 2
  1164. a317 2
  1165.                 DestroyWindow (hwndPDlg);    /* Delete Cancel Dialog */            
  1166.                 hwndPDlg = NULL;
  1167. d368 2
  1168. a369 2
  1169.               MessageBox(hWnd, "Your Print request has been canceled via a "
  1170.                                "cancel request from Windows Print Manager",
  1171. d406 26
  1172. d449 2
  1173. a450 2
  1174.     FARPROC lpfnAbort;
  1175.     FARPROC lpfnPDlg;
  1176. d462 1
  1177. a462 1
  1178.     lpfnAbort = MakeProcInstance (AbortProc, hInst);
  1179. d465 1
  1180. a465 1
  1181.     lpfnPDlg = MakeProcInstance (PrintDlgProc, hInst);
  1182. d551 1
  1183. a551 1
  1184.     FreeProcInstance (lpfnPDlg);
  1185. d554 1
  1186. a554 1
  1187.     FreeProcInstance (lpfnAbort);
  1188. d562 1
  1189. a562 28
  1190. }
  1191.  
  1192.  
  1193. /****************************************************************************
  1194.  *                                        *
  1195.  *  FUNCTION   : PrintHeaderP ()                        *
  1196.  *                                        *
  1197.  *  PURPOSE    : Determines if this is a header we are printing            *
  1198.  *                                        *
  1199.  *        Entry:  str    substring to search                                *
  1200.  *                limit  limits the search to no more than num characters   *
  1201.  *                                                                          *
  1202.  *        Exit:   BOOL   TRUE if we are not excluding print this header     *
  1203.  *                       FALSE if we are explicited excluding header        *
  1204.  *                                        *
  1205.  ****************************************************************************/
  1206.  
  1207. BOOL WINAPI PrintHeaderP(char *str,int limit)
  1208.   {
  1209.     if (CompareStringNoCase(str,"Relay-Version:",limit) == 0
  1210.         || CompareStringNoCase(str,"Path:",limit) == 0
  1211.         || CompareStringNoCase(str,"References:",limit) == 0
  1212.         || CompareStringNoCase(str,"Xref:",limit) == 0)
  1213.       return(FALSE);
  1214.     else
  1215.       return(TRUE);
  1216.   } 
  1217.  
  1218. d583 4
  1219. a586 2
  1220.     BOOL    inheader = TRUE;
  1221.     unsigned int LineLen,Offset, PageNum;
  1222. a588 1
  1223.     WORD    fError = TRUE;
  1224. d595 4
  1225. a598 5
  1226.     int      i,dy,dx,yExtPage,yExtSoFar,iLine,nPrintError,
  1227.              nCharsPerLine,nLinesPerPage,nTotalLines,
  1228.              nTotalPages;
  1229.     DEVNAMES * dv;        
  1230.  
  1231. d606 1
  1232. d612 2
  1233. a613 1
  1234.     InitPrintFonts();                                                 
  1235. d616 4
  1236. a619 2
  1237.     hwndPDlg = CreateDialog (hInst,"PRINTDIALOG",hwnd,
  1238.                                (DLGPROC) PrintDlgProc);
  1239. a621 1
  1240.     EnableWindow (hwnd, FALSE);
  1241. d627 3
  1242. a629 1
  1243.     if (SetAbortProc(pd.hDC,AbortProc) < 0)
  1244. d633 1
  1245. d640 1
  1246. a640 1
  1247.     SetDlgItemText (hwndPDlg, IDD_PRINTSUBJECT, (LPSTR)szTitle);
  1248. d643 1
  1249. a643 1
  1250.     SetDlgItemText (hwndPDlg, IDD_PRINTDEVICE, (LPSTR)sz);
  1251. d646 1
  1252. a646 1
  1253.     SetDlgItemText (hwndPDlg, IDD_PRINTSTATUS, (LPSTR)sz);
  1254. d650 1
  1255. a650 1
  1256.     if (!PdlgAbort && (nPrintError < 0))
  1257. d652 4
  1258. a655 4
  1259.         MessageBox(hwnd, "Unable to Initialize Document",
  1260.                          "Error",MB_OK | MB_ICONEXCLAMATION);
  1261.         goto exitout;
  1262.       }
  1263. d676 1
  1264. a676 1
  1265.     if (nPrintError <= 0) goto errout;
  1266. d705 2
  1267. a706 1
  1268.                 /* Tell device driver to eject page */  
  1269. d769 2
  1270. d773 1
  1271. a773 8
  1272.  
  1273.     if (PdlgAbort)
  1274.      {
  1275.         AbortDoc(pd.hDC);
  1276.         MessageBox(hwnd, "Print Request Canceled",
  1277.                          "Canceled",MB_OK | MB_ICONEXCLAMATION);
  1278.      }
  1279.     else if (nPrintError >= 0)
  1280. a792 3
  1281. errout:
  1282.     if (!PdlgAbort && (nPrintError < 0))  ReportPrintError(nPrintError,hwnd);
  1283.  
  1284. d794 17
  1285. a810 2
  1286.     if (!PdlgAbort)  EnableWindow (hwnd, TRUE);   /* ReEnable main procedure */
  1287.     if (hwndPDlg) DestroyWindow (hwndPDlg);    /* Delete Cancel Dialog */         
  1288. @
  1289.  
  1290.  
  1291. 1.16
  1292. log
  1293. @yet another attempt at fixing printing
  1294. @
  1295. text
  1296. @d42 1
  1297. a42 1
  1298.  * $Id: wvprint.c 1.15 1994/07/26 22:17:28 dumoulin Exp dumoulin $
  1299. d44 3
  1300. a95 1
  1301. #include <print.h>
  1302. @
  1303.  
  1304.  
  1305. 1.15
  1306. log
  1307. @Changed function prototype for printing function
  1308. @
  1309. text
  1310. @d26 1
  1311. a26 1
  1312.  *                ReportPrintError ()     -  Decodes err codes for calls  *
  1313. d42 1
  1314. a42 1
  1315.  * $Id: wvprint.c 1.14 1994/06/30 16:32:13 dumoulin Exp dumoulin $
  1316. d44 3
  1317. d98 1
  1318. a98 1
  1319. BOOL fAbort = FALSE;          /* TRUE if the user has aborted the print job     */
  1320. d108 1
  1321. a108 1
  1322. BOOL WINAPI AbortProc ( HDC hdc,WORD nCode)
  1323. d110 12
  1324. a121 4
  1325.   MSG msg;
  1326.   hdc;        /* Needed to prevent compiler warning message */
  1327.   nCode;    /* Needed to prevent compiler warning message */  
  1328.  
  1329. d123 1
  1330. a123 1
  1331.     while (!fAbort && PeekMessage (&msg, NULL, NULL, NULL, TRUE))
  1332. d128 7
  1333. a134 1
  1334.     return !fAbort;
  1335. d222 1
  1336. a222 1
  1337.         sprintf(mes,"Comm Dialog Box Extended Error %d (%d)", (DWORD) cError, (DWORD) pd.lStructSize);
  1338. d304 1
  1339. d309 1
  1340. a309 1
  1341.         fAbort = TRUE;
  1342. d474 1
  1343. a474 1
  1344.     while ((iLine < nLinesEc) && !fAbort) {
  1345. d477 1
  1346. a477 1
  1347.         if (Escape (hdc, NEWFRAME, 0, NULL, NULL) < 0 || fAbort)
  1348. d621 1
  1349. a621 1
  1350.     fAbort = FALSE;
  1351. d642 1
  1352. a642 1
  1353.     if (!fAbort && (nPrintError < 0))
  1354. d683 1
  1355. a683 1
  1356.     while ((iLine < nTotalLines) && !fAbort) {
  1357. d701 1
  1358. a701 1
  1359.                 if ((nPrintError < 0) || fAbort) break;
  1360. d703 1
  1361. a703 1
  1362.                  if ((nPrintError < 0) || fAbort) break;
  1363. d763 1
  1364. a763 1
  1365.     if (fAbort)
  1366. d785 1
  1367. a785 1
  1368.           if (!fAbort && (nPrintError >= 0))
  1369. d790 1
  1370. a790 1
  1371.     if (!fAbort && (nPrintError < 0))  ReportPrintError(nPrintError,hwnd);
  1372. d793 1
  1373. a793 1
  1374.     if (!fAbort)  EnableWindow (hwnd, TRUE);   /* ReEnable main procedure */
  1375. @
  1376.  
  1377.  
  1378. 1.14
  1379. log
  1380. @Fix Printing Bug - Call stack problem with AbortProc Procedure
  1381. @
  1382. text
  1383. @d42 1
  1384. a42 1
  1385.  * $Id: wvprint.c 1.13 1994/06/23 23:11:30 dumoulin Exp dumoulin $
  1386. d44 3
  1387. d391 1
  1388. a391 1
  1389. VOID WINAPI PrintFile(HWND hwnd)
  1390. d557 1
  1391. a557 1
  1392. VOID WINAPI PrintArticle(HWND hwnd,TypDoc * Doc)
  1393. @
  1394.  
  1395.  
  1396. 1.13
  1397. log
  1398. @Added support for new Print Dialog box and features
  1399. @
  1400. text
  1401. @d10 1
  1402. a10 1
  1403.  *  FUNCTIONS    : FreePrinterDC ()       -  Frees all memory associated  *
  1404. d16 3
  1405. d42 1
  1406. a42 1
  1407.  * $Id: wvprint.c 1.12 1994/06/17 09:08:14 dumoulin Exp dumoulin $
  1408. d44 3
  1409. d92 64
  1410. a155 11
  1411. BOOL fAbort = FALSE;    /* TRUE if the user has aborted the print job     */
  1412. HWND hwndPDlg = NULL;    /* Handle to the cancel print dialog         */
  1413. PRINTDLG pd;            /* Global structure to hold printer defaults     */
  1414. BOOL pSetup = FALSE;    /* TRUE when printer structure is initialized    */
  1415. char * szTitle;         /* Global pointer to job title                   */
  1416. char szExtDeviceMode[] = "EXTDEVICEMODE";
  1417.  
  1418.  
  1419. int FAR PASCAL AbortProc (HDC,WORD);         /* Prototype  */ 
  1420.  
  1421.        
  1422. d158 1
  1423. a158 1
  1424.  *  FUNCTION   : FreePrinterDC ()                        *
  1425. d164 1
  1426. a164 1
  1427.  *  RETURNS    : TRUE if successful, FALSE if nothing to free            *
  1428. d167 7
  1429. a173 25
  1430. BOOL FAR PASCAL FreePrinterDC(void)
  1431.  { 
  1432.    if (pd.hDC)
  1433.       {                              /* Free Printer Context */
  1434.        if (pd.hDevMode)  
  1435.          {
  1436.            GlobalFree(pd.hDevMode);
  1437.            pd.hDevMode = NULL;
  1438.          }
  1439.        if (pd.hDevNames) 
  1440.          {
  1441.            GlobalFree(pd.hDevNames);
  1442.            pd.hDevNames = NULL;
  1443.          }
  1444.        if (pd.hDC)
  1445.             {
  1446.               DeleteDC(pd.hDC);
  1447.               pd.hDC = NULL;
  1448.              }           
  1449.              
  1450.         pSetup = FALSE;
  1451.         return TRUE;
  1452.        }
  1453.    else
  1454.        return FALSE;
  1455. d184 1
  1456. a184 1
  1457.  *  RETURNS    : Zero if successful, else Extended Error Code on Failure    *
  1458. d187 22
  1459. a208 13
  1460. DWORD FAR PASCAL PrinterSetup(HWND hwnd,DWORD flags)
  1461.  {
  1462.   /*  Setup a handle to a printer if one hasn't been setup before */ 
  1463.     if (!pSetup) 
  1464.       {
  1465.         memset((void *) &pd,0,sizeof(PRINTDLG));
  1466.         pd.lStructSize = sizeof(PRINTDLG);
  1467.   
  1468.         pd.hInstance = NULL; 
  1469.        pd.hDevMode = NULL;
  1470.         pd.hDevNames = NULL;
  1471.         pd.nMaxPage = 0xFFFE;
  1472.         pSetup = TRUE;
  1473. d210 2
  1474. a211 6
  1475.                              
  1476.     pd.hwndOwner = hwnd;
  1477.     pd.Flags = hwnd ? flags : flags | PD_SHOWHELP;                                          
  1478.                                                  
  1479.     if (PrintDlg(&pd) == 0)
  1480.       return CommDlgExtendedError();
  1481. d223 1
  1482. a223 1
  1483.  *  RETURNS    : HDC - A handle to printer DC                           *
  1484. d226 3
  1485. a228 4
  1486. HDC FAR PASCAL GetPrinterDC(HWND hwnd)
  1487.  {
  1488.   char mes[60];
  1489.   DWORD  cError = 0;
  1490. d230 12
  1491. a241 11
  1492.   if (!pSetup || (pd.hDC == 0))
  1493.     cError = PrinterSetup(hwnd,PD_RETURNDC | PD_RETURNDEFAULT);
  1494.     if ((cError != 0) && (hwnd != 0))
  1495.       { 
  1496.         sprintf(mes,"Comm Dialog Box Extended Error %d", (DWORD) cError);
  1497.         MessageBox(hwnd, "WinVN was unable to either display a "
  1498.                          "Printer Device Context Dialog Box or "
  1499.                          "to get a Printer Device Context"
  1500.                          ,mes,MB_OK | MB_ICONEXCLAMATION);
  1501.        }
  1502.   return pd.hDC;
  1503. d243 1
  1504. a243 2
  1505.  
  1506.  
  1507. d246 4
  1508. a249 1
  1509.  *  FUNCTION   : AbortProc()                            *
  1510. d251 1
  1511. a251 1
  1512.  *  PURPOSE    : To be called by GDI print code to check for user abort.    *
  1513. d254 13
  1514. a266 5
  1515. BOOL CALLBACK AbortProc ( HDC hdc,WORD nCode)
  1516. {
  1517.   MSG msg;
  1518.   hdc;        /* Needed to prevent compiler warning message */
  1519.   nCode;    /* Needed to prevent compiler warning message */  
  1520. a267 8
  1521.     /* Allow other apps to run, or get abort messages */
  1522.     while (!fAbort && PeekMessage (&msg, NULL, NULL, NULL, TRUE))
  1523.     if (!hwndPDlg || !IsDialogMessage (hwndPDlg, &msg)){
  1524.         TranslateMessage (&msg);
  1525.         DispatchMessage  (&msg);
  1526.     }
  1527.     return !fAbort;
  1528. }
  1529. d279 2
  1530. a280 7
  1531. BOOL FAR PASCAL PrintDlgProc(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
  1532.  {               
  1533.  
  1534.     char szDevice[160];    /* contains the device driver info string */
  1535.     char * szDriver;       /* Pointer to the Driver Name */
  1536.     char * szPort;           /* contains the port of the default printer */
  1537.                     
  1538. a283 10
  1539.         /* Set up information in dialog box */
  1540.     //        CreateIC(szDriver, szDevice,szPort, &pd.hDevMode);   
  1541.             GetProfileString("windows", "device", "", szDevice, sizeof(szDevice));
  1542.             for (szDriver = szDevice; *szDriver && *szDriver != ','; szDriver++);
  1543.     //        if (*szDriver) *szDriver++ = 0;
  1544.             for (szPort = szDriver; *szPort && *szPort != ','; szPort++);
  1545.             if (*szPort) *szPort++ = 0;
  1546.            SetDlgItemText (hwnd, IDD_PRINTDEVICE, (LPSTR)szDevice);
  1547.     //        SetDlgItemText (hwnd, IDD_PRINTPORT, (LPSTR)szPort);
  1548.         SetDlgItemText (hwnd, IDD_PRINTSUBJECT, (LPSTR)szTitle);
  1549. d313 1
  1550. a313 1
  1551. void ReportPrintError(int nError,HWND hWnd)
  1552. d388 1
  1553. a388 1
  1554. VOID FAR PASCAL PrintFile(HWND hwnd)
  1555. a407 9
  1556.  
  1557.     /* Create the job title by loading the title string from STRINGTABLE */
  1558.   /* 
  1559.     cch = LoadString (hInst, IDS_PRINTJOB, sz, sizeof(sz)); 
  1560.     szTitle = sz + cch;
  1561.     cch += GetWindowText (hwnd, sz + cch, 32 - cch);
  1562.     sz[31] = 0;
  1563.   */
  1564.  
  1565. a510 2
  1566. /*    PPError (hwnd, MB_OK | MB_ICONEXCLAMATION, IDS_PRINTERROR, (LPSTR)szTitle);  */
  1567.  
  1568. d529 1
  1569. a529 3
  1570.   BOOL PrintHeaderP(str,limit)
  1571.     char *str;
  1572.     int  limit;
  1573. a549 1
  1574. // #define RIGHTMARGIN 10   /* Right Margin in characters on printed page */ 
  1575. d552 1
  1576. a552 1
  1577. #define MAXHEADERSIZE 20
  1578. d554 1
  1579. a554 1
  1580. VOID FAR PASCAL PrintArticle(HWND hwnd,TypDoc * Doc)
  1581. d556 2
  1582. a557 1
  1583.     char    sz[64],sbuf[MAXHEADERLINE];
  1584. d574 1
  1585. d576 3
  1586. a578 5
  1587.     /* Create the job title */ 
  1588.  
  1589.     strcpy(sz,"WinVN Print");
  1590.     di.cbSize = sizeof(DOCINFO);
  1591.     di.lpszDocName = "WinVn: Printing";
  1592. a580 5
  1593.     found = GetHeaderLine(Doc,"Subject:",sbuf,sizeof(sbuf));
  1594.     if (!found)
  1595.        lstrcpy(sbuf,"Subject: No Subject");
  1596.     szTitle = sbuf;
  1597.  
  1598. a581 1
  1599.     cError = PrinterSetup(hwnd,PD_RETURNDC);
  1600. d583 3
  1601. d587 3
  1602. a589 5
  1603.     if (!pd.hDC)
  1604.        {
  1605.     goto exitout;
  1606.        }
  1607.  
  1608. a590 1
  1609.  
  1610. d608 8
  1611. a615 1
  1612.     /* Initialize the document */                     
  1613. d618 2
  1614. d643 2
  1615. a644 1
  1616.     nTotalPages = (nTotalLines + nLinesPerPage -1) / nLinesPerPage;
  1617. d646 2
  1618. a647 1
  1619.     StartPage(pd.hDC);
  1620. d650 1
  1621. a650 1
  1622.     if (((pd.Flags & PD_ALLPAGES) != 0) ||
  1623. d656 2
  1624. a657 2
  1625.         SelectObject(pd.hDC,hFontPrintS);         /* Select Printer Font */
  1626.         TextOut (pd.hDC,LEFTMARGIN * dx,TOPMARGIN * dy,sbuf,lstrlen(sbuf));
  1627. d666 4
  1628. a669 3
  1629.         if (((pd.Flags & PD_ALLPAGES) != 0) ||
  1630.             (((pd.nFromPage == 0) || (PageNum >= pd.nFromPage))  && 
  1631.             ((pd.nToPage == 0)   || (PageNum <= pd.nToPage))))
  1632. d696 4
  1633. a699 3
  1634.             if (((pd.Flags & PD_ALLPAGES) != 0) ||
  1635.                 (((pd.nFromPage == 0) || (PageNum >= pd.nFromPage))  && 
  1636.              ((pd.nToPage == 0)   || (PageNum <= pd.nToPage))))
  1637. d751 4
  1638. a754 3
  1639.         if (((pd.Flags & PD_ALLPAGES) != 0) ||
  1640.             (((pd.nFromPage == 0) || (PageNum >= pd.nFromPage))  && 
  1641.         ((pd.nToPage == 0)   || (PageNum <= pd.nToPage))))
  1642. d768 2
  1643. a769 4
  1644.      if (!fAbort && (nPrintError < 0))
  1645.       {
  1646.        ReportPrintError(nPrintError,hwnd);
  1647.       }
  1648. d772 1
  1649. a772 1
  1650.     if (!fAbort) EnableWindow (hwnd, TRUE);    /* ReEnable main procedure */
  1651. @
  1652.  
  1653.  
  1654. 1.12
  1655. log
  1656. @Attempts to fix the Unable to Initialize Document printing bug
  1657. @
  1658. text
  1659. @d39 1
  1660. a39 1
  1661.  * $Id: wvprint.c 1.11 1994/06/14 20:22:37 dumoulin Exp dumoulin $
  1662. d41 3
  1663. d80 1
  1664. a80 1
  1665. #include "windows.h"                                         
  1666. a81 1
  1667. #include <commdlg.h>
  1668. d146 1
  1669. a146 1
  1670. DWORD FAR PASCAL PrinterSetup(HWND hwnd)
  1671. d157 1
  1672. a159 2
  1673.     
  1674.     /*  If hwnd is NULL, use defaults and don't popup a Dialog Box */
  1675. d162 2
  1676. a163 2
  1677.     pd.Flags = hwnd ? PD_RETURNDC : PD_RETURNDEFAULT;
  1678.     
  1679. d182 13
  1680. a194 1
  1681.   if (!pSetup) PrinterSetup(hwnd);
  1682. d235 1
  1683. a235 1
  1684.     char * szDriver;        /* Pointer to the Driver Name */
  1685. d245 1
  1686. a245 1
  1687.             if (*szDriver) *szDriver++ = 0;
  1688. d249 2
  1689. a250 2
  1690.         SetDlgItemText (hwnd, IDD_PRINTPORT, (LPSTR)szPort);
  1691.         SetDlgItemText (hwnd, IDD_PRINTTITLE, (LPSTR)szTitle);
  1692. d541 1
  1693. a541 1
  1694.     unsigned int LineLen,Offset;
  1695. d553 1
  1696. a553 2
  1697.              nTotalPages,PageNum;
  1698.         
  1699. d568 1
  1700. a568 1
  1701.     cError = PrinterSetup(hwnd);
  1702. d595 3
  1703. a597 1
  1704.     /* Initialize the document */
  1705. a622 4
  1706.  
  1707.     SelectObject(pd.hDC,hFontPrintS);         /* Select Printer Font */
  1708.     TextOut (pd.hDC,LEFTMARGIN * dx,TOPMARGIN * dy,sbuf,lstrlen(sbuf));
  1709.     yExtSoFar = (int)dy * (TOPMARGIN + 4);
  1710. d624 12
  1711. d641 19
  1712. a659 9
  1713.         /* Reached the end of a page, print Page number */
  1714.             SelectObject(pd.hDC,hFontPrintB);
  1715.             sprintf(sz,"Page %u",PageNum);
  1716.             TextOut(pd.hDC, ((nCharsPerLine / 2) * dx),
  1717.                               yExtSoFar + (2 * dy), sz, lstrlen(sz));
  1718.  
  1719.             /* Tell device driver to eject page */
  1720.             nPrintError = EndPage(pd.hDC);
  1721.             if ((nPrintError < 0) || fAbort) break;
  1722. a661 2
  1723.             nPrintError = StartPage(pd.hDC);
  1724.             if ((nPrintError < 0) || fAbort) break;
  1725. d670 9
  1726. a678 8
  1727.  
  1728.             if (inheader)
  1729.              {
  1730.            loc = memchr(textptr,':',MAXHEADERSIZE);
  1731.                if (loc)
  1732.                  {
  1733.                    i =  loc-textptr+1;
  1734.                    if (PrintHeaderP(textptr,i))
  1735. d680 9
  1736. a688 6
  1737.                          SelectObject(pd.hDC,hFontPrintB);
  1738.                          TextOut (pd.hDC, (LEFTMARGIN * dx), yExtSoFar, textptr, i);
  1739.                          SelectObject(pd.hDC,hFontPrint);
  1740.                          TextOut (pd.hDC, (LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  1741.                                   yExtSoFar, textptr+i, LineLen - i);
  1742.                         yExtSoFar += dy;
  1743. d690 17
  1744. a706 19
  1745.                  }
  1746.                else
  1747.                  {
  1748.                    SelectObject(pd.hDC,hFontPrint);
  1749.                    TextOut (pd.hDC,(LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  1750.                              yExtSoFar, textptr, LineLen);
  1751.                    yExtSoFar += dy;
  1752.                  }
  1753.              }
  1754.             else
  1755.               {
  1756.            if (isLineQuotation(textptr)) SelectObject(pd.hDC,hFontPrintI);
  1757.                 else
  1758.                    SelectObject(pd.hDC,hFontPrint);
  1759.  
  1760.                TextOut (pd.hDC, (LEFTMARGIN * dx), yExtSoFar, textptr, LineLen);
  1761.                yExtSoFar += dy;
  1762.               }
  1763.  
  1764. d725 10
  1765. a734 5
  1766.         SelectObject(pd.hDC,hFontPrintB);
  1767.           sprintf(sz,"Page %u",PageNum);
  1768.           TextOut(pd.hDC, ((nCharsPerLine / 2) * dx),
  1769.                       yExtPage - (BOTTOMMARGIN * dy), sz, lstrlen(sz));
  1770.         nPrintError = EndPage(pd.hDC);
  1771. d748 1
  1772. a748 2
  1773.     if (hwndPDlg) DestroyWindow (hwndPDlg);    /* Delete Cancel Dialog */
  1774.  //   FreePrinterDC();              
  1775. @
  1776.  
  1777.  
  1778. 1.11
  1779. log
  1780. @Fix various printer problems due to short instead of int variable
  1781. @
  1782. text
  1783. @d10 4
  1784. a13 1
  1785.  *  FUNCTIONS    : GetPrinterDC ()       -  Creates a printer DC for the *
  1786. d17 1
  1787. d39 1
  1788. a39 1
  1789.  * $Id: wvprint.c 1.10 1994/05/19 02:06:10 dumoulin Exp dumoulin $
  1790. d41 3
  1791. d75 1
  1792. a75 1
  1793.  */
  1794. d77 3
  1795. a79 1
  1796. #include "windows.h"
  1797. d86 3
  1798. a88 10
  1799. char szDevice[160];    /* Contains the device, the driver, and the port */
  1800. char * szDriver;    /* Pointer to the driver name             */
  1801. char * szPort;        /* Port, ie, LPT1                 */
  1802. char * szTitle;        /* Global pointer to job title             */
  1803. int iPrinter = 0;    /* level of available printer support.         */
  1804.             /* 0 - no printer available             */
  1805.             /* 1 - printer available             */
  1806.             /* 2 - driver supports 3.0 device initialization */
  1807. HANDLE hInitData=NULL;    /* handle to initialization data         */
  1808.  
  1809. d90 2
  1810. a91 1
  1811.  
  1812. d93 40
  1813. a132 1
  1814.  
  1815. d135 1
  1816. a135 1
  1817.  *  FUNCTION   : GetPrinterDC ()                        *
  1818. d141 34
  1819. a174 1
  1820.  *  RETURNS    : HDC   - A handle to printer DC.                *
  1821. d176 2
  1822. d179 7
  1823. a185 68
  1824. HDC FAR PASCAL GetPrinterDC(void)
  1825. {
  1826.     HDC      hdc;
  1827.     LPSTR    lpdevmode = NULL;
  1828.  
  1829.     iPrinter = 0;
  1830.  
  1831.     /* Get the printer information from win.ini into a buffer and
  1832.      * null terminate it.
  1833.      */
  1834.     GetProfileString ( "windows", "device", "" ,szDevice, sizeof(szDevice));
  1835.     for (szDriver = szDevice; *szDriver && *szDriver != ','; szDriver++)
  1836.     ;
  1837.     if (*szDriver)
  1838.     *szDriver++ = 0;
  1839.  
  1840.     /* From the current position in the buffer, null teminate the
  1841.      * list of ports
  1842.      */
  1843.     for (szPort = szDriver; *szPort && *szPort != ','; szPort++)
  1844.     ;
  1845.     if (*szPort)
  1846.     *szPort++ = 0;
  1847.  
  1848.     /* if the device, driver and port buffers all contain meaningful data,
  1849.      * proceed.
  1850.      */
  1851.     if (!*szDevice || !*szDriver || !*szPort){
  1852.     *szDevice = 0;
  1853.     return NULL;
  1854.     }
  1855.  
  1856.     /* Create the printer display context */
  1857.     if (hInitData){
  1858.     /* Get a pointer to the initialization data */
  1859.     lpdevmode = (LPSTR) LocalLock (hInitData);
  1860.  
  1861.     if (lstrcmp (szDevice, lpdevmode)){
  1862.         /* User has changed the device... cancel this setup, as it is
  1863.          * invalid (although if we worked harder we could retain some
  1864.          * of it).
  1865.          */
  1866.         lpdevmode = NULL;
  1867.         LocalUnlock (hInitData);
  1868.         LocalFree (hInitData);
  1869.         hInitData = NULL;
  1870.     }
  1871.     }
  1872.     hdc = CreateDC (szDriver, szDevice, szPort, lpdevmode);
  1873.  
  1874.     /* Unlock initialization data */
  1875.     if (hInitData)
  1876.     LocalUnlock (hInitData);
  1877.  
  1878.     if (!hdc)
  1879.     return NULL;
  1880.  
  1881.  
  1882.     iPrinter = 1;
  1883.  
  1884.     /* Find out if ExtDeviceMode() is supported and set flag appropriately */
  1885.     if (GetProcAddress (GetModuleHandle (szDriver), szExtDeviceMode))
  1886.     iPrinter = 2;
  1887.  
  1888.     return hdc;
  1889.  
  1890. }
  1891.  
  1892. d219 6
  1893. a224 1
  1894.  {
  1895. d226 1
  1896. a226 1
  1897.       {
  1898. d229 7
  1899. a235 1
  1900.         SetDlgItemText (hwnd, IDD_PRINTDEVICE, (LPSTR)szDevice);
  1901. d267 1
  1902. a267 1
  1903. void ReportPrintError(short nError,HWND hWnd)
  1904. d322 1
  1905. a322 1
  1906.               sprintf(mes,"Unknown Print Error %d", (short) nError);
  1907. d383 1
  1908. a383 1
  1909.     hdc = GetPrinterDC();
  1910. d523 2
  1911. a524 1
  1912. {
  1913. d526 2
  1914. a527 1
  1915.     HDC     hdcPrn = NULL;
  1916. a528 1
  1917.     char    sz[64],sbuf[MAXHEADERLINE];
  1918. a530 2
  1919.     BOOL    found;
  1920.     BOOL    inheader = TRUE;
  1921. d532 1
  1922. d538 2
  1923. a539 2
  1924.     int      i,dy,dx,yExtPage,yExtSoFar,iLine,nPrintError;
  1925.     short    nCharsPerLine,nLinesPerPage,nTotalLines,
  1926. d541 1
  1927. d543 2
  1928. a544 1
  1929.     /* Create the job title */
  1930. d547 1
  1931. a547 1
  1932.     di.lpszDocName = "WinVn Article";
  1933. d555 2
  1934. a556 1
  1935.     /* Initialize the printer */
  1936. d558 3
  1937. a560 2
  1938.     hdcPrn = GetPrinterDC();
  1939.     if (!hdcPrn)
  1940. d562 1
  1941. d566 1
  1942. a566 1
  1943.     hwndPDlg = CreateDialog (hInst, "PRINTDIALOG",hwnd,
  1944. d576 1
  1945. a576 1
  1946.     if (SetAbortProc(hdcPrn,AbortProc) < 0)
  1947. d584 2
  1948. a585 2
  1949.     nPrintError = StartDoc(hdcPrn,&di);
  1950.     if ((fAbort == FALSE) && (nPrintError < 0))
  1951. d601 2
  1952. a602 2
  1953.     SelectObject(hdcPrn,hFontPrint);         /* Select Printer Font */
  1954.     GetTextMetrics(hdcPrn,&tm);
  1955. d605 2
  1956. a606 2
  1957.     nCharsPerLine = GetDeviceCaps (hdcPrn,HORZRES) / dx;
  1958.     nLinesPerPage = GetDeviceCaps (hdcPrn,VERTRES) / dy;
  1959. d608 1
  1960. a608 1
  1961.     yExtPage = GetDeviceCaps (hdcPrn, VERTRES);
  1962. d610 2
  1963. a611 2
  1964.     SelectObject(hdcPrn,hFontPrintS);         /* Select Printer Font */
  1965.     TextOut (hdcPrn,LEFTMARGIN * dx,TOPMARGIN * dy,sbuf,lstrlen(sbuf));
  1966. d613 1
  1967. a613 1
  1968.     StartPage(hdcPrn);
  1969. d620 1
  1970. a620 1
  1971.             SelectObject(hdcPrn,hFontPrintB);
  1972. d622 1
  1973. a622 1
  1974.             TextOut(hdcPrn, ((nCharsPerLine / 2) * dx),
  1975. d626 1
  1976. a626 1
  1977.             nPrintError = EndPage(hdcPrn);
  1978. d630 1
  1979. a630 1
  1980.             nPrintError = StartPage(hdcPrn);
  1981. d649 4
  1982. a652 4
  1983.                          SelectObject(hdcPrn,hFontPrintB);
  1984.                          TextOut (hdcPrn, (LEFTMARGIN * dx), yExtSoFar, textptr, i);
  1985.                          SelectObject(hdcPrn,hFontPrint);
  1986.                          TextOut (hdcPrn, (LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  1987. d659 2
  1988. a660 2
  1989.                    SelectObject(hdcPrn,hFontPrint);
  1990.                    TextOut (hdcPrn,(LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  1991. d667 1
  1992. a667 1
  1993.            if (isLineQuotation(textptr)) SelectObject(hdcPrn,hFontPrintI);
  1994. d669 1
  1995. a669 1
  1996.                    SelectObject(hdcPrn,hFontPrint);
  1997. d671 1
  1998. a671 1
  1999.                TextOut (hdcPrn, (LEFTMARGIN * dx), yExtSoFar, textptr, LineLen);
  2000. d686 1
  2001. a686 1
  2002.         AbortDoc(hdcPrn);
  2003. d693 1
  2004. a693 1
  2005.         SelectObject(hdcPrn,hFontPrintB);
  2006. d695 1
  2007. a695 1
  2008.           TextOut(hdcPrn, ((nCharsPerLine / 2) * dx),
  2009. d697 1
  2010. a697 1
  2011.         nPrintError = EndPage(hdcPrn);
  2012. d700 2
  2013. a701 2
  2014.           if (nPrintError >= 0)
  2015.           nPrintError = EndDoc(hdcPrn);
  2016. d706 1
  2017. a706 1
  2018.         ReportPrintError(nPrintError,hwnd);
  2019. d712 1
  2020. a712 1
  2021.     if (hdcPrn) DeleteDC(hdcPrn);              /* Free Printer Context */
  2022. @
  2023.  
  2024.  
  2025. 1.10
  2026. log
  2027. @*** empty log message ***
  2028. @
  2029. text
  2030. @d35 1
  2031. a35 1
  2032.  * $Id: wvprint.c 1.9 1994/01/15 20:41:22 jcoop Exp dumoulin $
  2033. d37 3
  2034. d471 4
  2035. a474 4
  2036.     if (CompareStringNoCase(str,"Relay-Version",limit) == 0
  2037.         || CompareStringNoCase(str,"Path",limit) == 0
  2038.         || CompareStringNoCase(str,"References",limit) == 0
  2039.         || CompareStringNoCase(str,"Xref",limit) == 0)
  2040. d511 1
  2041. a511 1
  2042.     int      i,dy,dx,yExtPage,yExtSoFar,iLine;
  2043. d513 1
  2044. a513 1
  2045.              nTotalPages,PageNum,nPrintError;
  2046. d553 1
  2047. a553 1
  2048.     if (!fAbort && (nPrintError < 0))
  2049. @
  2050.  
  2051.  
  2052. 1.9
  2053. log
  2054. @Use GetEditText instead of EM_GETHANDLE with global editWnds
  2055. @
  2056. text
  2057. @d35 1
  2058. a35 1
  2059.  * $Id: wvprint.c 1.8 1993/12/08 01:28:38 rushing Exp $
  2060. d37 3
  2061. a322 1
  2062. //    HANDLE  hT;
  2063. d471 1
  2064. a471 1
  2065.         || CompareStringNoCase(str,"Relay-Version",limit) == 0)
  2066. @
  2067.  
  2068.  
  2069. 1.8
  2070. log
  2071. @new version box and cr lf consistency
  2072. @
  2073. text
  2074. @d35 1
  2075. a35 1
  2076.  * $Id: wvprint.c 1.7 1993/08/09 17:57:47 dumoulin Exp rushing $
  2077. d37 3
  2078. d65 1
  2079. d319 2
  2080. a320 1
  2081.     HANDLE  hT;
  2082. d380 3
  2083. a382 2
  2084.     hT          = (HANDLE)SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L);
  2085.  
  2086. d396 2
  2087. a397 1
  2088.     pch = (char *)LocalLock(hT) + ich;
  2089. d401 1
  2090. a401 1
  2091.     LocalUnlock (hT);
  2092. d407 2
  2093. a408 1
  2094.  
  2095. @
  2096.  
  2097.  
  2098. 1.7
  2099. log
  2100. @Fix to AbortProc and PrintArticle to fix GPFs
  2101. @
  2102. text
  2103. @d32 1
  2104. d35 1
  2105. a35 1
  2106.  * $Id: wvprint.c 1.6 1993/08/05 15:46:42 dumoulin Exp dumoulin $
  2107. d37 3
  2108. a62 1
  2109. #include "wvdlg.h"
  2110. @
  2111.  
  2112.  
  2113. 1.6
  2114. log
  2115. @Rewrote PrintArticle to solve print crashes
  2116. @
  2117. text
  2118. @d34 1
  2119. a34 1
  2120.  * $Id: wvprint.c 1.5 1993/07/06 21:09:09 cnolan Exp $
  2121. d36 3
  2122. d62 2
  2123. a63 2
  2124. BOOL fAbort;        /* TRUE if the user has aborted the print job     */
  2125. HWND hwndPDlg;        /* Handle to the cancel print dialog         */
  2126. d203 6
  2127. a314 1
  2128.     HWND    hwndPDlg;
  2129. a482 1
  2130.     FARPROC lpfnPDlg = NULL;
  2131. a488 1
  2132.     HWND    hwndPDlg;
  2133. a509 6
  2134.     /* Make instances of the Print dialog function */
  2135.  
  2136.     lpfnPDlg = MakeProcInstance (PrintDlgProc, hInst);
  2137.     if (!lpfnPDlg)
  2138.     goto exitout;
  2139.  
  2140. d518 2
  2141. a519 1
  2142.     hwndPDlg = CreateDialog (hInst, "PRINTDIALOG", hwnd, lpfnPDlg);
  2143. a529 2
  2144.         EnableWindow (hwnd, TRUE);
  2145.         DestroyWindow (hwndPDlg);
  2146. a538 2
  2147.         EnableWindow (hwnd, TRUE);
  2148.         DestroyWindow (hwndPDlg);
  2149. a635 4
  2150.     /* Get rid of Cancel Print Dialog Box */
  2151.     EnableWindow (hwnd, TRUE);
  2152.     DestroyWindow (hwndPDlg);
  2153.  
  2154. a660 1
  2155.  
  2156. d662 3
  2157. a664 2
  2158.     if (hdcPrn) DeleteDC(hdcPrn);                /* Free Printer Context */
  2159.     if (lpfnPDlg) FreeProcInstance (lpfnPDlg);   /* Free Dialog box proc */
  2160. @
  2161.  
  2162.  
  2163. 1.5
  2164. log
  2165. @win32 support
  2166. @
  2167. text
  2168. @a6 2
  2169.  *                  Based on examples from Petzold's Programming Windows   *
  2170.  *                  book & code from the SDK Samples Directory             *
  2171. d18 3
  2172. d25 3
  2173. d34 1
  2174. a34 1
  2175.  * $Id: wvprint.c 1.4 1993/05/25 00:00:55 rushing Exp $
  2176. d36 3
  2177. d161 1
  2178. a161 3
  2179. int FAR PASCAL AbortProc ( hdc, reserved )
  2180. HDC hdc;
  2181. WORD reserved;
  2182. d163 3
  2183. a165 1
  2184.     MSG msg;
  2185. a166 3
  2186.      hdc;        /* Needed to prevent compiler warning message */
  2187.      reserved;    /* Needed to prevent compiler warning message */
  2188.  
  2189. d187 3
  2190. a189 5
  2191. {
  2192.  /*     wParam;  */    /* Needed to prevent compiler warning message */
  2193.  /*     lParam;  */    /* Needed to prevent compiler warning message */
  2194.  
  2195.     switch (msg){
  2196. d195 1
  2197. a195 1
  2198.         break;
  2199. d198 1
  2200. a198 1
  2201.         /* abort printing if the only button gets hit */
  2202. d200 1
  2203. a200 1
  2204.         break;
  2205. d204 80
  2206. a283 3
  2207.     }
  2208.     return TRUE;
  2209. }
  2210. d356 2
  2211. a357 2
  2212.     GetTextExtentPoint (hdc, "CC", 2, &size);              
  2213.     dy=size.cy;                                            
  2214. d367 1
  2215. a367 1
  2216.     while (iLine < nLinesEc){
  2217. a384 4
  2218.     /* Test and see if the Abort flag has been set. If yes, exit. */
  2219.     if (fAbort)
  2220.         goto getout2;
  2221.  
  2222. d461 1
  2223. a461 1
  2224.  *  PURPOSE    : Prints the contents of the edit control.            *
  2225. d473 5
  2226. a477 5
  2227.     HDC     hdcPrn;
  2228.     int     yExtPage,yExtSoFar,iLine;
  2229.     unsigned int LineLen;
  2230.     char    sz[32];
  2231.     char    sbuf[MAXHEADERLINE];
  2232. a481 1
  2233.     FARPROC lpfnAbort,lpfnPDlg;
  2234. a482 1
  2235.     int     i,dy,dx;
  2236. a485 1
  2237.     unsigned int Offset;
  2238. d489 1
  2239. d491 1
  2240. a491 1
  2241.              nTotalPages,PageNum;
  2242. d494 5
  2243. a498 1
  2244.     lstrcpy(sz,"WinVN Print Request");
  2245. d504 2
  2246. a505 4
  2247.     /* Make instances of the Abort proc. and the Print dialog function */
  2248.     lpfnAbort = MakeProcInstance (AbortProc, hInst);
  2249.     if (!lpfnAbort)
  2250.     goto getout;
  2251. d508 1
  2252. a508 1
  2253.     goto getout4;
  2254. d511 1
  2255. d514 6
  2256. a519 1
  2257.     goto getout5;
  2258. a520 1
  2259.     /* Disable the main application window and create the Cancel dialog */
  2260. a521 3
  2261.     hwndPDlg = CreateDialog (hInst, "PRINTDIALOG", hwnd, lpfnPDlg);
  2262.     if (!hwndPDlg)
  2263.     goto getout3;
  2264. d525 10
  2265. a534 3
  2266.     /* Allow the app. to inform GDI of the escape function to call */
  2267.     if (Escape (hdcPrn, SETABORTPROC, 0, (LPSTR)lpfnAbort, NULL) < 0)
  2268.     goto getout1;
  2269. d537 9
  2270. a545 2
  2271.     if (Escape (hdcPrn, STARTDOC, lstrlen(sz), sz, NULL) < 0)
  2272.     goto getout1;
  2273. d550 1
  2274. a550 1
  2275.   /* Get the lines in document and and a handle to the text buffer */
  2276. d568 1
  2277. a568 4
  2278.  
  2279.     /* While more lines print out the text */
  2280.     while (iLine < nTotalLines){
  2281.     if ((yExtSoFar + (BOTTOMMARGIN + 1) * dy) >= yExtPage){
  2282. d570 4
  2283. d581 2
  2284. a582 2
  2285.             if (Escape (hdcPrn, NEWFRAME, 0, NULL, NULL) < 0 || fAbort)
  2286.         goto getout2;
  2287. d585 3
  2288. a587 1
  2289.     }
  2290. a593 1
  2291.      /*       if (LineLen == 0) inheader = FALSE; */
  2292. a632 4
  2293.     /* Test and see if the Abort flag has been set. If yes, exit. */
  2294.     if (fAbort)
  2295.         goto getout2;
  2296.  
  2297. a636 11
  2298.     /* Eject the last page. */
  2299.  
  2300.     SelectObject(hdcPrn,hFontPrintB);
  2301.     sprintf(sz,"Page %u",PageNum);
  2302.     TextOut(hdcPrn, ((nCharsPerLine / 2) * dx),
  2303.                       yExtPage - (BOTTOMMARGIN * dy), sz, lstrlen(sz));
  2304.  
  2305.     if (Escape (hdcPrn, NEWFRAME, 0, NULL, NULL) < 0)
  2306.     goto getout2;
  2307.  
  2308.     /* Complete the document. */
  2309. d639 1
  2310. a639 10
  2311.     if (Escape (hdcPrn, ENDDOC, 0, NULL, NULL) < 0){
  2312. getout2:
  2313.     /* Ran into a problem before NEWFRAME? Abort the document */
  2314.     Escape( hdcPrn, ABORTDOC, 0, NULL, NULL);
  2315.     }
  2316.     else
  2317.     fError=FALSE;
  2318.  
  2319. getout3:
  2320.     /* Close the cancel dialog and re-enable main app. window */
  2321. d643 14
  2322. a656 15
  2323. getout1:
  2324.     DeleteDC(hdcPrn);
  2325.  
  2326. getout5:
  2327.     /* Get rid of dialog procedure instances */
  2328.     FreeProcInstance (lpfnPDlg);
  2329.  
  2330. getout4:
  2331.     FreeProcInstance (lpfnAbort);
  2332.  
  2333. getout:
  2334.  
  2335.     /* Error? make sure the user knows... */
  2336.     if (fError)
  2337.         MessageBox(hwnd, "Printing Error","Error",MB_OK);
  2338. d658 14
  2339. a673 3
  2340.  
  2341.  
  2342.  
  2343. @
  2344.  
  2345.  
  2346. 1.4
  2347. log
  2348. @rot13 merge (MRB)
  2349. @
  2350. text
  2351. @d30 1
  2352. a30 1
  2353.  * $Id: wvprint.c 1.3 1993/03/09 01:24:21 dumoulin Exp $
  2354. d32 3
  2355. d232 1
  2356. d277 2
  2357. a278 1
  2358.     dy = HIWORD (GetTextExtent (hdc, "CC", 2));
  2359. d300 1
  2360. a300 1
  2361.     pch = LocalLock(hT) + ich;
  2362. d594 1
  2363. a594 1
  2364.  @
  2365.  
  2366.  
  2367. 1.3
  2368. log
  2369. @Added italics for quoted regions in prints
  2370. @
  2371. text
  2372. @d30 5
  2373. a34 2
  2374.  * $Id: wvprint.c%v 1.2 1993/02/16 22:52:25 dumoulin Exp rushing $
  2375.  * $Log: wvprint.c%v $
  2376. d500 1
  2377. a500 1
  2378.                loc = memchr(textptr,':',MAXHEADERSIZE);
  2379. d524 1
  2380. a524 3
  2381.                loc = memchr(textptr,'>',2);
  2382.                if (!loc) loc = memchr(textptr,'|',2);
  2383.                if (loc) SelectObject(hdcPrn,hFontPrintI);
  2384. @
  2385.  
  2386.  
  2387. 1.2
  2388. log
  2389. @moved rcs ident comment below file description
  2390. @
  2391. text
  2392. @d30 1
  2393. a30 1
  2394.  * $Id: wvprint.c%v 1.1 1993/02/16 20:54:22 rushing Exp dumoulin $
  2395. d32 3
  2396. d348 3
  2397. a350 1
  2398.  *  FUNCTION   : FindChar ()                                *
  2399. d352 1
  2400. a352 4
  2401.  *  PURPOSE    : Finds the first occurance of a character in a buffer       *
  2402.  *                                                                          *
  2403.  *        Entry:  buf    points to a buffer                                 *
  2404.  *                ch     is the comparison character                        *
  2405. d355 2
  2406. a356 2
  2407.  *        Exit:   int    points to the location of the character if found   *
  2408.  *                       NULL if character is not found                     *
  2409. d360 2
  2410. a361 3
  2411.   int FindChar(buf,ch,limit)
  2412.     char far *buf;
  2413.     char ch;
  2414. d364 8
  2415. a371 11
  2416.     int  loc = 0;
  2417.     while (limit-- && *buf && (*buf != ch))
  2418.       {
  2419.         buf++;
  2420.         loc++;
  2421.       }
  2422.     if (limit == 0)
  2423.        return(NULL);
  2424.      else
  2425.        return(loc);
  2426.   }
  2427. d396 1
  2428. d492 2
  2429. a493 1
  2430.             if (LineLen == 0) inheader = FALSE;
  2431. d497 2
  2432. a498 2
  2433.                i = FindChar(textptr,':',MAXHEADERSIZE);
  2434.                if (i)
  2435. d500 10
  2436. a509 5
  2437.                    SelectObject(hdcPrn,hFontPrintB);
  2438.                    TextOut (hdcPrn, (LEFTMARGIN * dx), yExtSoFar, textptr, i+1);
  2439.                    SelectObject(hdcPrn,hFontPrint);
  2440.                    TextOut (hdcPrn, (LEFTMARGIN + MAXHEADERSIZE + 2) * dx,
  2441.                             yExtSoFar, textptr+i+1, LineLen - i - 1);
  2442. d516 1
  2443. d521 6
  2444. a526 1
  2445.                SelectObject(hdcPrn,hFontPrint);
  2446. d528 1
  2447. a538 1
  2448.     yExtSoFar += dy;
  2449. @
  2450.  
  2451.  
  2452. 1.1
  2453. log
  2454. @Initial revision
  2455. @
  2456. text
  2457. @a0 7
  2458. /*
  2459.  *
  2460.  * $Id$
  2461.  * $Log$
  2462.  *
  2463.  */
  2464.  
  2465. d27 10
  2466. @
  2467.